<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
	
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>超市账单管理系统-用户管理</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<script type="text/javascript">
function page_nav(frm,num){
	frm.pageIndex.value=num;
	frm.flag.value="fenye";
	frm.submit();
}
function jump_to(frm,pageno){
	var regexp=/^\d+$/;
	if(!regexp.test(pageno)){
		alert("请输入正确的数字");
		return false;
	}else{
		page_nav(frm,pageno);
	}	
}
</script>
	<style>
ul{
	list-style:none;
	}
	.test_ul li{
	float:left;
	} 
	</style>
</head>
<body>

	<div class="menu">

		<table>
			<tbody>
				<tr>
					<td>
						<form method="post" action="UserServlet">
							<input type="hidden" name="flag" value="fenye"/>
							<input type="hidden"  id="pageIndex"name="pageIndex" />
							 用户名：<input id="userName" name="userName" 
							 class="input-text" type="text" value="${userName}">
							 &nbsp;&nbsp;&nbsp;&nbsp; 
							 <input  value="查 询" type="submit">
						</form>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<div class="main">

		<div class="optitle clearfix">
			<em><input value="添加用户" class="input-button"
				onClick="window.location='userAdd.jsp'" type="button"> </em>
			<div class="title">用户管理&gt;&gt;</div>
		</div>
		
		<div class="content">
			<table class="list">
				<tbody>
					<tr>
						<td width="70" height="29"><div class="STYLE1" align="center">编号</div></td>
						<td width="80"><div class="STYLE1" align="center">用户名</div></td>
						<td width="80"><div class="STYLE1" align="center">用户账号</div></td>
						<td width="100"><div class="STYLE1" align="center">性别</div></td>
						<td width="100"><div class="STYLE1" align="center">出生年月</div></td>
						<td width="150"><div class="STYLE1" align="center">电话</div></td>
						<td width="150"><div class="STYLE1" align="center">权限</div></td>
					</tr>

					
					<c:forEach var="user" items="${userList}">

					<tr>
						<td height="23"><span class="STYLE1"> ${user.user_id}</span></td>
						<td><span class="STYLE1"> ${user.name }</span></td>
						<td><span class="STYLE1"><a href="UserServlet?flag=toView&id=${user.user_id}"
								style="color:red"> ${user.loginnane}</a> </span></td>

						<td><span class="STYLE1">
						<c:if test="${user.gender==1}">男</c:if> 
						<c:if test="${user.gender==0}">女</c:if>
						</span></td>
						<td><span class="STYLE1"> ${user.birthdate}</span></td>
						<td><span class="STYLE1">${user.phone}</span></td>
						<td><span class="STYLE1">
						<c:if test="${user.user_type==1}">管理员</c:if> 
						<c:if test="${user.user_type==2}">普通用户</c:if> 
						<c:if test="${user.user_type==3}">经理</c:if> 
						 </span></td>
					</tr>
					</c:forEach>
				</tbody>
			</table>
			<div class="page-bar">
			<ul class="test_ul">
			<li>总记录数：${pages.totalCount }&nbsp;&nbsp;${pages.currPageNo } / ${pages.totalPageCount }<li>&nbsp;&nbsp;&nbsp;
                             <li><a href="javaScript:page_nav(document.forms[0],1)" >首页</a><li>&nbsp;&nbsp;
                            <li><a href="javaScript:page_nav(document.forms[0],${pages.currPageNo-1 })">上一页</a><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <li><a href="javaScript:page_nav(document.forms[0],${pages.currPageNo+1 })">下一页</a><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <li><a href="javaScript:page_nav(document.forms[0],${pages.totalPageCount })">末页</a><li>&nbsp;&nbsp;&nbsp;
			</ul>
			<span class="page-go-form"><label>跳转至</label><input type="text" name="numkey" id="numkey" class="page-key" />页<button type="submit" class="page-btn" onclick="javaScript:jump_to(document.forms[0],document.getElementById('numkey').value)">GO</button></span>
			</div>
			
		</div>
		
	</div>
	
</body>
</html>